From 659734ae4fc0229102ebea13db417a69c3a9384f Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sat, 12 Nov 2022 15:34:19 -0700 Subject: [PATCH] relax time constraints on trackfilter move. (#945) 1. don't require all track points to have time, just leave timeless track points alone. 2. don't require track points to be ordered by time for move. This also results in the tracks not being sorted by time for move only operations. Instead the original order is preserved. --- trackfilter.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/trackfilter.cc b/trackfilter.cc index d157249b2..f60371f26 100644 --- a/trackfilter.cc +++ b/trackfilter.cc @@ -574,11 +574,22 @@ void TrackFilter::trackfilter_move() return; } + int timeless_points = 0; + for (auto* track : qAsConst(track_list)) { foreach (Waypoint* wpt, track->waypoint_list) { - wpt->creation_time = wpt->creation_time.addSecs(delta); + if (wpt->creation_time.isValid()) { + wpt->creation_time = wpt->creation_time.addSecs(delta); + } else { + ++timeless_points; + } } } + if (timeless_points > 0) { + warning(MYNAME "-move: %d points out of %d total points didn't have " + "time information and could not be moved.\n", + timeless_points, track_waypt_count()); + } } /******************************************************************************* @@ -961,7 +972,7 @@ void TrackFilter::init() */ need_time = ( opt_merge || opt_pack || opt_split || opt_sdistance || - opt_move || opt_fix || opt_speed || + opt_fix || opt_speed || (trackfilter_opt_count() == 0) /* do pack by default */ ); /* in case of a formatted title we also need valid timestamps */ -- 2.30.2